<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Clipboard Demo</title>
</head>
<body>
    <main>
        <h1>clipboard demo</h1>
        <button id="btn">点击复制</button>
        <div class="result"></div>
    </main>

    <script type="module">
        import { copy } from '../src/clipboard.js';

        document.querySelector('#btn').addEventListener('click', () => {
            const str = `Now is ${new Date()}`;
            const result = copy(str);

            document.querySelector('.result').innerHTML = result ? '复制成功' : '复制失败';
        });
    </script>
</body>
</html>